package cn.ricecode.mybatis.controller;

import cn.ricecode.mybatis.entity.User;
import cn.ricecode.mybatis.entity.UserJson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author LiuZhulan
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @RequestMapping("/add/params")
    public User  add(User user){
        log.info("{}",user.getTime());

        return User.builder().time(new Date()).build();
    }

    @RequestMapping("/add/json")
    public UserJson  addJson(@RequestBody UserJson user){
        log.info("{}",user.getTime());

        return UserJson.builder().time(new Date()).build();
    }
}
